package com.TeamJigsaw.DanteTrail.Models;

import java.awt.Image;

import javax.swing.ImageIcon;

/**
 * Represents a Player party member
 * @author David Chi
 *
 */
public class Player extends PartyMember{

	private boolean isDead;
	
	private Profession profession;
	
	public static final int POLI_START_MONEY = 1600;
	
	public static final int CON_START_MONEY = 800;
	
	public static final int MURD_START_MONEY = 400;
	
	/**
	 * Creates and initializes a Player with specified name
	 * @param name The player's name
	 */
	public Player(String name) {
		super(name);
		profession = null;
		isDead = false;
	}
	
	/**
	 * Creates and initializes a Player with specified
	 * name and picture
	 * @param name The player's name
	 * @param memberPic The player's picture 
	 */
	public Player(String name, Image memberPic) {
		this(name);
		this.memberPic = memberPic;
	}
	
	public int getMoney (){
		return profession.getStartMoney();
	}
	
	/**
	 * Returns if the player is dead or not
	 * @return If the player is dead or not
	 */
	public boolean getIsDead() {
		return isDead;
	}
	
	/**
	 * Sets the player to dead
	 * @return Whether the operation was successful or not
	 */
	public boolean setIsDead() {
		isDead = true;
		return true;
	}
	
	public Profession getProfession() {
		return profession;
	}
	
	@Override
	public String getName() {
		return name;
	}
	
	/**
	 * Sets the player's profession while returning the amount of
	 * money the player starts with
	 * @param professionType The ID of the player's profession
	 * @return The amount of money the profession starts with
	 */
	public int setProfession(int professionType) {
		if(professionType == 1) {
			profession = new Politician();
			memberPic = new ImageIcon("resources\\politician.gif").getImage();
			return POLI_START_MONEY;
		}
		else if(professionType == 2) {
			profession = new Conman();
			memberPic = new ImageIcon("resources\\conman.gif").getImage();
			return CON_START_MONEY;
		}
		else if(professionType == 3) {
			profession = new Murderer();
			memberPic = new ImageIcon("resources\\murderer.gif").getImage();
			return MURD_START_MONEY;
		}
		return 0;
	}
	
}
